package com.wk.controller;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.ws.rs.POST;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;

import org.dozer.Mapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.stereotype.Controller;

import com.wk.model.User;
import com.wk.service.IUserService;
import com.wk.service.impl.UserService;




@Controller
@Path("/test")
@Produces(MediaType.APPLICATION_JSON + ";charset=utf-8")
public class LoginController {

    @Autowired
    private IUserService userService;
    
    @Autowired
    private Mapper mapper;
    
    /**
     * 用户登陆服务
     * @param userName
     * @param password
     * @param isIos
     * @param deviceId
     * @param loginType
     * @param iosToken
     * @param request
     * @param response
     * @return
     */
    
    @POST
    @Path("/ok")
    public void ok(@Context final HttpServletRequest request,
            @Context final HttpServletResponse response) {
        
    	User user =userService.getUser();
    	
    	System.out.println(user.getId());
    } 
    
    
    public static void main(String[] args) {
    	ApplicationContext appContext = new AnnotationConfigApplicationContext("com.wk");  
    	UserService config =appContext.getBean(UserService.class);
    	
    	System.out.println(config.getUser());
    			
	}
}
